﻿<!DOCTYPE html>
<html  xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <link th:href="@{/administration/css/reset.css}" rel="stylesheet" />
    <link th:href="@{/administration/css/iconfont.css}" rel="stylesheet" />
    <link th:href="@{/administration/css/index.css}" rel="stylesheet" />
    <script th:src="@{/administration/js/jquery-1.9.1.min.js}"></script>
    <script th:src="@{/administration/js/f.js}"></script>

    <script type="text/javascript">
        $(document).ready(function() {
            $("#query").css("color","white");
            $(function () {
                alert($("#RoleMessage").value());
                if ($("#RoleMessage").value()=="你的权限不够") {
                    alert("你的权限不够");
                }
            })
            //实现全选
            $("#inputcheck").click(function () {
                // this 全选的复选框
                var userids = this.checked;
                //获取name=box的复选框 遍历输出复选框
                $("input[name=box]").each(function () {
                    this.checked = userids;
                });
            });
            //批量删除
            $("#deletes").click(function () {
                var delSize = $("[name=box]:checked").size();
                var uName_list = []
                var uNames='';
                $("[name=box]:checked").each(function () {
                    uName_list.push($(this).val())
                    uNames+=$(this).val()+",";
                });
                $.post("/UsersDelete",
                    {uNames:uNames},
                    function (data) {
                    for ( var i=0;i<delSize;i++){
                        var  uName=uName_list[i];
                        $("[id="+uName + "]").parent().parent().remove();
                    }
                    }
                );
                //
            })
        });
    </script>
    <title>用户管理</title>
</head>
<body>
    <div class="PublicHead clearfix">
        <div class="leftBox clearfix">
            <div class="companyLogo">
                <img th:src="@{/administration/images/logo.jpg}" />
            </div>
            <!--<i class="iconfont icon-caidan Js_MenuList"></i>-->

            <div class="companyText">
                后台订单管理
                <input type="hidden" id="RoleMessage" th:value="${RoleMessage}">
            </div>
        </div>
        <div class="RightBox clearfix">
            <div class="UserPhotoBox">
                <div class="UserPic">
                    <img th:src="@{/administration/images/user.jpg}" />
                </div>
                <div class="UserName">
                    [[${uName}]]
                </div>
            </div>
            <a href="/Signout">
                <div class="dropOutBox">
                    <i class="iconfont icon-app_icons--">
                    </i>
                    <span>退出</span>
                </div>
            </a>
        </div>
    </div>

    <div class="PublicDownWhole clearfix">
        <!--左侧-->
        <div class="leftBox Js_leftBox">
            <ul>
                <a th:href="@{/toUserManagement}"> <li class="Select"><i class="iconfont icon-yonghuguanli"></i><span>用户管理</span></li></a>
                <a th:href="@{/toOrderManagement}">
                    <li><i class="iconfont icon-tubiao_dingdan"></i><span>订单管理</span></li>
                </a>
            </ul>
        </div>
        <!--右侧-->
        <div class="RightBox Js_RightBox">
            <div class="PublicContentBox">
                <!--公用指向页面名字-->
                <div class="PublicPointToAgeText">
                    <span class="span1">用户管理</span> <span class="span2">后台用户管理列表</span>
                </div>
                <!--查询-->
                <div class="InquireBox clearfix">

                    <form th:action="@{/UserQuery}">
                    <div class="InquireleftBox">
                        <div class="Text">用户名：</div>
                        <div class="InputDiv">   <input class="phoneInput" id="queryuName" name="uName" placeholder="请输入你需要查询的用户名" /></div>
                        <div class="Text">手机号：</div>
                        <div class="InputDiv">   <input class="phoneInput" id="queryphone" name="phone" placeholder="请输入你需要查询的手机号" /></div>
                    </div>
                    <div class="PublicBtnIcon Color1Btn fr">
                        <i class="iconfont icon-icon-chaxun"></i>
                       <input type="submit" id="query" value="查询">
                    </div>
                    </form>
                </div>
                <!--表修改-->
                <div class="InquireTableBox">
                    <div class="headbox">
                        <div class="headboxtext">
                            <span class="span1">后台用户管理列表</span>
                        </div>
                        <!--批量删除-->
                        <div class="PublicBtnIcon Color5Btn">
                            <a id="deletes">
                            <i class="iconfont  icon-shanchu"></i>
                            <span>批量删除</span>
                            </a>
                        </div>

                        <div class="PublicBtnIcon Color2Btn fr Js_edit">
                            <i class="iconfont icon-changyongtubiao-mianxing-"></i>
                            <span>添加</span>
                        </div>
                    </div>

                    <!--查询到的表格-->

                    <div class="InquireSelectTable">
                        <table class="PublicTableCss" >
                            <thead>
                                <tr>
                                    <td>
                                        <input id="inputcheck" class="inputcheck" type="checkbox" name="inputcheck" />
                                        <label for="inputcheck"></label>
                                        <span>全选/取消选中</span>
                                    </td>
                                    <td>用户名</td>
                                    <td>手机号</td>
                                    <td>邮箱号码</td>
                                    <td>居住城市</td>
                                    <td>性别</td>
                                    <td>权限</td>
                                    <td>权限解释</td>
                                    <td>操作</td>
                                </tr>

                            </thead>
                            <tbody>
                                <tr th:each="user:${userList}">
                                    <td>
                                        <input th:attr="id=${user.getuName()}" class="inputcheck"  type="checkbox" name="box" th:value="${user.getuName()}"/>
                                        <label th:attr="for=${user.getuName()}"></label>
                                    </td>
                                    <td th:text="${user.uName}"></td>
                                    <td th:text="${user.phone}"></td>
                                    <td th:text="${user.email}"></td>
                                    <td th:text="${user.address}"></td>
                                    <td th:text="${user.sex}"></td>
                                    <td th:if="${user.getRole()==0}" th:text="用户"></td>
                                    <td th:if="${user.getRole()==1}" th:text="初级管理员"></td>
                                    <td th:if="${user.getRole()==2}" th:text="高级管理员"></td>
                                    <td>0为用户权限；1为初级管理员；2为高级管理员</td>
                                    <td>

                                        <div class="PublicTableBtnIcon Color3Btn Js_updat">
                                            <i class="iconfont icon-tubiaozhizuomobanyihuifu-"></i>
                                            <input type="hidden" id="Updatename" th:value="${user.getuName()}">
                                            <span><a>编辑</a></span>
                                        </div>

                                        <div class="PublicTableBtnIcon Color4Btn Js_Userdelete">
                                            <i class="iconfont icon-shanchu"></i>
                                            <input type="hidden" id="Deletename" th:value="${user.getuName()}">
                                            <span><a>删除</a></span>
                                        </div>
                                    </td>
                                </tr>

                            </tbody>
                        </table>

                    </div>
                    <!--分页-->
          <!--          <div class="PageNumber">
                        <div class="NumbersBox">
                            <div class="LeftArrow">
                                上一页
                            </div>
                            <ul>
                                <li class="Select">1</li>
                                <li class="">2</li>
                                <li class="">...</li>
                                <li class="">4</li>
                                <li class="">5</li>
                            </ul>
                            <div class="RightArrow ">
                                下一页
                            </div>
                        </div>
                    </div>-->


                </div>
            </div>

        </div>
    </div>


    <!-- alert通用 提示是否删除-->
    <!--<div class="PublicFloatBox f_delete">
        <div class="f_MiddleBox wid260">
            <div class="f_Head">
                <span>提示消息</span>
                <i class="Js_deletecloseBtn iconfont icon-buoumaotubiao20 fr"></i>
            </div>
            <div class="f_content clearfix">
                &lt;!&ndash;提示消息内容&ndash;&gt;
                <div class="f_someText">
                    <i class="iconfont icon-tishi"></i>
                    <span>确定删除此信息？</span>
                </div>
                &lt;!&ndash;按钮&ndash;&gt;
                <div class="f_pormatBtn  clearfix">
                    <div class="f_pormatBtn1">
                        <input type="button" id="DeleteUser" th:value="确定">
                    </div>
                    <div class="f_pormatBtn2 Js_deletecloseBtn">
                        <input type="button" th:value="取消">
                    </div>
                </div>
            </div>
        </div>
    </div>-->
    <!--添加用户浮层-->
    <div class="PublicFloatBox adduser">
        <div class="f_MiddleBox wid400">
            <div class="f_Head">
                <span>添加用户</span>
                <i class="Js_closeBtn iconfont icon-buoumaotubiao20 fr"></i>
            </div>

            <div class="f_content">
                <form th:action="@{/addUesr}">
                <div class="f_alonediv">
                    <div class="f_alone_name">
                        用户名：
                    </div>
                    <div class="f_alone_input">
                        <input id="Adduname" name="uName" class="f_p_input" />
                    </div>
                </div>
                <div class="f_alonediv">
                    <div class="f_alone_name">
                        手机号：
                    </div>
                    <div class="f_alone_input">
                        <input  id="Addphone" name="phone" class="f_p_input" />
                    </div>
                    <!--提示消息-->
                    <div class="f_pormat">
                        请输入正确的手机号
                    </div>
                </div>
                <div class="f_alonediv">
                    <div class="f_alone_name">
                        邮箱号：
                    </div>
                    <div class="f_alone_input">
                        <input id="AddEmail" name="email" class="f_p_input" />
                    </div>
                    <!--提示消息-->
                    <div class="f_pormat">
                        请输入正确的邮箱号
                    </div>
                </div>
                <div class="f_alonediv">
                    <div class="f_alone_name">
                        居住城市：
                    </div>
                    <div class="f_alone_input">
                        <input id="Addaddress" name="address" class="f_p_input" />
                    </div>
                </div>
                <div class="f_alonediv">
                    <div class="f_alone_name">
                        密码：
                    </div>
                    <div class="f_alone_input">
                        <input id="AddPwd" type="password" name="uPwd" class="f_p_input" />
                    </div>
                </div>
                <div class="f_alonediv">
                    <div class="f_alone_name">
                        性别：
                    </div>
                    <div class="f_alone_input">
                        <input id="Addsex"  name="sex" class="f_p_input" />
                    </div>
                    <!--提示消息-->
                    <div class="f_pormat">
                        请输入性别（男或女）
                    </div>
                </div>
                <div class="f_alonediv">
                    <div class="f_alone_name">
                        权限：
                    </div>
                    <div class="f_alone_input">
                        <select id="Addrole" name="role" th:value="请选择用户权限">
                            <option value="0" >用户</option>

                            <option value="1" >初级管理员</option>

                            <option value="2" >高级管理员</option>

                        </select>

                    </div>

                </div>


                <div class="f_alonediv1">
                    <div class="f_alone_name">
                    </div>
                    <div class="f_alone_input1">
                        <!--publicbtn-->
                        <div class="publicf_btn">
                            <div class="publicf_btn1" >
                                <input type="submit" th:value="确定">
                            </div>
                            <div class="publicf_btn2 fr Js_closeBtn">
                                <input type="reset" th:value="取消">
                            </div>
                        </div>
                    </div>
                </div>
            </form>
            </div>

        </div>
    </div>
    <!--修改用户权限-->
    <div class="PublicFloatBox Updateuser">
        <div class="f_MiddleBox wid400">
            <div class="f_Head">
                <span>修改用户权限</span>
                <i class="Js_updatecloseBtn iconfont icon-buoumaotubiao20 fr"></i>
            </div>

            <div class="f_content">
                <form th:action="@{/updateRole}">
                    <div class="f_alonediv">
                        <div class="f_alone_name">
                            用户名：
                        </div>
                        <div class="f_alone_input">
                            <input id="updateuname" name="uName" class="f_p_input" readonly="readonly" />
                        </div>
                    </div>

                    <div class="f_alonediv">
                        <div class="f_alone_name">
                            权限：
                        </div>
                        <div class="f_alone_input">
                            <select id="updateurole" name="role">
                                <option >请修改用户权限</option>
                                <option value="0" >用户</option>

                                <option value="1" >初级管理员</option>

                                <option value="2" >高级管理员</option>

                            </select>

                        </div>

                    </div>


                    <div class="f_alonediv1">
                        <div class="f_alone_name">
                        </div>
                        <div class="f_alone_input1">
                            <!--publicbtn-->
                            <div class="publicf_btn">
                                <div class="publicf_btn1" >
                                    <input type="submit" th:value="确定">
                                </div>
                                <div class="publicf_btn2 fr Js_updatecloseBtn">
                                    <input type="reset" th:value="取消">
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>

        </div>
    </div>

    <!--返回顶部-->
    <a href="javaScript:void(0);" class="back-to-top"><i class="iconfont icon-fanhuidingbu"></i> </a>
</body>
</html>